<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="author" content="lijinbo" />
    <script type="text/javascript" src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-y/vue/2.6.14/vue.min.js"></script>
    <title>202-js生成随机位置且不重叠的div充满容器</title>
    <style>
      .max {
        width: 80vw;
        height: 50vw;
        border: 1px solid #999;
        box-sizing: border-box;
        position: relative;
      }
      .item_box {
        border: 1px solid #e1e1e1;
        border-radius: 50%;
        padding: 10px;
        position: absolute;
        display: flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
        font-size: 14px;
      }
    </style>
    <script type="module" crossorigin src="../../../../static/js/202-index.html-0ababfc0.js"></script>
    <link rel="modulepreload" crossorigin href="../../../../static/common/modulepreload-polyfill-3cfb730f.js">
  </head>

  <body>
    <div id="app">
      <div>
        <p>生成数量：<input v-model.number="count" type="number" placeholder="生成数量" /></p>
        <p>dom大小：<input v-model.number="domSize" type="number" placeholder="dom大小" /></p>
        <p>
          <button @click="initUserList">重置</button>
        </p>
      </div>
      <div id="container" class="max">
        <div v-for="(item, index) in list" :key="index" class="item_box" :style="item.style">{{ item.name }}</div>
      </div>
    </div>
    
  </body>
</html>
